package com.wc.fake;

import com.wc.domain.Dept;
import com.wc.domain.Emp;
import com.wc.meiju.Role;
import com.wc.utils.Md5Util;
import com.wc.utils.RandomUtil;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wanghao
 */
public class DB {
    public static List<Dept> depts = new ArrayList<>();
    public static List<Emp> emps = new ArrayList<>();

    static {
        depts.add(new Dept(10, "sales", "CHICAGO"));
        depts.add(new Dept(20, "research", "NEWYORK"));

        String salt1 = RandomUtil.genString(5, RandomUtil.genInteger(16, 24));
        emps.add(new Emp(1001, "张三", "clerk", 7788, LocalDate.now(), new BigDecimal(88), new BigDecimal(8), 10, "zhangsan", Md5Util.encode("1234", salt1), salt1, Role.ADMIN));
        String salt2 = RandomUtil.genString(5, RandomUtil.genInteger(16, 24));
        emps.add(new Emp(1002, "李四", "clerk", 7788, LocalDate.now(), new BigDecimal(88), new BigDecimal(8), 20, "lisi", Md5Util.encode("1234", salt2), salt2, Role.COMMON));
        String salt3 = RandomUtil.genString(5, RandomUtil.genInteger(16, 24));
        emps.add(new Emp(1003, "王二", "clerk", 7788, LocalDate.now(), new BigDecimal(88), new BigDecimal(8), 30, "wanger", Md5Util.encode("1234", salt3), salt3, Role.COMMON));

        emps.forEach(System.out::println);
    }
}